package data.structure;

public class TreeNode {
    public int val;
    public TreeNode left;
    public TreeNode right;

    TreeNode() {
    }

    public TreeNode(int val) {
        this.val = val;
    }

    public TreeNode(int val, TreeNode left, TreeNode right) {
        this.val = val;
        this.left = left;
        this.right = right;

    }
    // 提供一个方法，用来打印树
    public static void printTree(TreeNode root)  
    {
        if (root == null)
            return;
        printTree(root.left);
        System.out.println(root.val);
        printTree(root.right);
    }
}
